pub mod request;
pub mod response;

use crate::component::request::Request;
use ureq::Header;

/// Task.parser 的解析结果
pub struct ParseResult<ItemType: Clone> {
    pub reqs: Vec<Request<ItemType>>,
    pub items: Vec<ItemType>,
}

impl<ItemType: Clone> ParseResult<ItemType> {
    pub fn new(reqs: Vec<Request<ItemType>>, items: Vec<ItemType>) -> Self {
        Self { reqs, items }
    }
}

#[derive(Clone)]
pub struct Headers {
    pub headers: Vec<Header>,
}

impl Headers {
    pub fn new(headers: Vec<Header>) -> Self {
        Self { headers }
    }
    pub fn add_header(&mut self, name: &str, value: &str) {
        let header = Header::new(name, value);
        self.headers.push(header);
    }
}
